<template>
  <div>
    <el-dialog
      title=""
      :visible.sync="dialogVisible"
      width="40%"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      @close="resetForm"
    >
      <el-descriptions
        title="详细信息"
        :column="1"
      >
        <el-descriptions-item label="组名称">{{ ruleForm.device_name }}</el-descriptions-item>
        <el-descriptions-item label="责任人">{{ ruleForm.device_num }}</el-descriptions-item>
        <el-descriptions-item label="责任人联系方式">{{ ruleForm.site_name }}</el-descriptions-item>
        <el-descriptions-item label="分组">{{ ruleForm.group_name }}</el-descriptions-item>

      </el-descriptions>
      <div style="display: flex;justify-content: flex-end">
        <el-button type="primary" @click="resetForm">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { detailGroup } from '@/api/operations'

export default {
  name: 'info',
  props: {
    id: {
      type: Number,
      default: 0
    },
    dialogVisible: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      optionsType: [],
      optionsSite: [],
      ruleForm: {}
    }
  },
  created() {
    this.getDetailById(this.id)
  },
  methods: {
    // 获取详情
    getDetailById(id) {
      detailGroup({ id }).then(res => {
        this.ruleForm = res.data
      })
    },
    // 表单重置
    resetForm() {
      this.$emit('close')
    }
  }
}
</script>

<style scoped>

</style>
